Socket
Socket
Sign inDemoInstall

server-ready

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

server-ready

Know when a server is ready to receive requests


Version published
Weekly downloads
1.7K
increased by36.95%
Maintainers
1
Weekly downloads
 
Created
Source

server-ready Build Status npm version

Know when a server is ready to receive requests. Used in hotel.

Install

npm install server-ready --save

Example

var serverReady = require('server-ready')
var port = 3000

// A server process is spawned here or somewhere else...
serverReady(port, function (err) {
  if (err) return console.error('timeout, can\'t connect to port')
  console.log('port is open or has just opened')
})

How it works?

server-ready will try to connect every 250ms to the specified port until a connection has been made or timeout has been reached (20s by default).

API

serverReady.timeout

Default timeout.

serverReady(port[, host][, timeout], cb)

Tries to connect to port.

License

MIT - Typicode

Keywords

FAQs

Package last updated on 27 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc